﻿using System.Diagnostics.CodeAnalysis;

namespace Common.Dto;


public class Result<T>
{
    public int Code { get; set; }
    public string Message { get; set; }
    
    [AllowNull]
    public T Data { get; set; }
}

public static class Result
{
    public static Result<T> Success<T>(T data, string message = "SUCCESS")
    {
        return new Result<T>() { Data = data, Message = message, Code = 200 };
    }

    public static Result<object> Failure(string message = "ERROR", int code = 500)
    {
        return new Result<object>() { Message = message, Code = code };
    }
}